package entityancientmusbeabstract;

import org.eclipse.emf.ecore.EObject;

import org.eclipse.viatra2.emf.incquery.validation.runtime.Constraint;
import org.eclipse.viatra2.emf.incquery.validation.runtime.ValidationUtil;
import org.eclipse.viatra2.emf.incquery.runtime.api.impl.BaseGeneratedMatcherFactory;
import entityancientmusbeabstract.EntityAncientMusBeAbstractMatch;
import entityancientmusbeabstract.EntityAncientMusBeAbstractMatcherFactory;
import entityancientmusbeabstract.EntityAncientMusBeAbstractMatcher;

public class EntityAncientMusBeAbstractConstraint extends Constraint<EntityAncientMusBeAbstractMatch> {

	private EntityAncientMusBeAbstractMatcherFactory matcherFactory;

	public EntityAncientMusBeAbstractConstraint() {
		matcherFactory = new EntityAncientMusBeAbstractMatcherFactory();
	}

	@Override
	public String getMessage() {
		return "$ancient.name$ entity must be abstract!";
	}

	@Override
	public EObject getLocationObject(EntityAncientMusBeAbstractMatch signature) {
		Object location = signature.get("ancient");
		if(location instanceof EObject){
			return (EObject) location;
		}
		return null;
	}
	
	@Override
	public int getSeverity() {
		return ValidationUtil.getSeverity("error");
	}
	
	@Override
	public BaseGeneratedMatcherFactory<EntityAncientMusBeAbstractMatch, EntityAncientMusBeAbstractMatcher> getMatcherFactory() {
		return matcherFactory;
	}
}
